package leetcode.code2109;

import leetcode.IDebug;

public class Solution implements IDebug {

	public String addSpaces(String s, int[] spaces) {
		StringBuffer sb = new StringBuffer();
		char[] cs = s.toCharArray();
		int p = 0;
		for (int i = 0; i < spaces.length; i++) {
			int index = spaces[i];
			while (p < index) {
				sb.append(cs[p++]);
			}
			sb.append(' ');
		}
		while (p < cs.length) {
			sb.append(cs[p++]);
		}
		return sb.toString();
	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
